<?php
class Stationsummary {
	private $data;

	public function __construct() {
	}

	public function setData($data) {
		$this->data = $data;
	}

	public function display() {
		echo '<h2>Station information</h2>';
		echo '<table border="1">';
		echo '<tr>';
		echo 	'<td>';
		echo		'Station ID';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][0];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Name';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][1];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Country';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][2];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Latitude';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][3];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Longitude';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][4];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Elevation';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][5];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo	'</td>';
		echo 	'<td>';
		echo		'<a href="index.php?action=map&lat='.$this->data[0][3].'&lng='.$this->data[0][4].'">View on map</a>';
		echo	'</td>';
		echo '</tr>';
		echo '</table>';
		
		echo '<h2>Station measurements</h2>';
		echo '<table border="1">';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Temprature';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][6];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Dew Point';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][7];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Station Level Pressure';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][8];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Sea Level Pressure';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][9];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Visibility';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][10];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Windspeed';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][11];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Precipitation';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][12];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Snowfall';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][13];
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Events';
		echo	'</td>';
		echo 	'<td>';
		echo 		readFRSHTT($this->data[0][14]);
		echo	'</td>';
		echo '</tr>';
		echo '<tr>';
		echo 	'<td>';
		echo		'Avg. Cloud Coverage';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][15];
		echo	'</td>';
		echo '</tr>';
		echo 	'<td>';
		echo		'Avg. Wind Direction';
		echo	'</td>';
		echo 	'<td>';
		echo		$this->data[0][16];
		echo	'</td>';
		echo '</tr>';
		echo '</table>';
	}

}

?>